{*********************************************************************************
*
* index.tpl
*
* Шаблон для отображения формочки фильтра товаров
*
* @package Store
* @author Игорь Будасов aka Lord <igor.budasov@gmail.com> 
*
*********************************************************************************} 
{if $cid neq 0}
        
    {* Показываем формочку фильтра товаров *}
	{literal}
	<style>
	    dd#price_from-element, dd#price_to-element, dd#rating_from-element, dd#rating_to-element{
        margin-left: 10px;    
        display: inline;
        float: left;
        width: 80px;
        margin-bottom: -3px;
    }
    #fieldset-priceFieldsGroup, #fieldset-ratingFieldsGroup{
        padding:2px;    
    }
    INPUT[type="text"], 
    INPUT[type="file"], 
    INPUT[type="select"],
    INPUT[type="password"],
    select{
        width:40%;
    }

	</style>
	{/literal}

<div id="filter">
{*  ############################ ФОРМА ###################################### *}
<form enctype="application/x-www-form-urlencoded" action="/store/filter/index/cid/{$cid}" method="post" name=""><dl class="zend_form">
<fieldset id="fieldset-priceFieldsGroup"><legend>Цена товара</legend>
{$form->price_from}
{$form->price_to}
<div class="clear"></div>
<span id="price_trackbar">{literal}        
<script type="text/javascript">
// User function
function setPriceLimits(from, to) {
    var values = ['',
        {/literal}
        {foreach from=$prices item=price name=price_foreach}
            {if $smarty.foreach.price_foreach.first}{assign var=price_min value=$price}{/if}
            '{$price}',
            {if $smarty.foreach.price_foreach.last}{assign var=price_max value=$price}{/if}
            {assign var=right_value value=$smarty.foreach.price_foreach.iteration}
        {/foreach}
        {literal}
    ];
    document.getElementById("price_from").value = values[from];
    document.getElementById("price_to").value = values[to];
}


trackbar.getObject('price').init({
    onMove : function() {
        setPriceLimits(this.leftValue, this.rightValue);
    },
    width : 160, // px
    leftLimit : {/literal}1{literal}, // unit of value
    leftValue : {/literal}
        {if !empty($price_from)}
            {$price_from}
        {else}
            1
        {/if}{literal}, // unit of value
    rightLimit : {/literal}{$right_value}{literal}, // unit of value
    rightValue : {/literal}
        {if !empty($price_from)}
            {$price_to}
        {else}
            {$right_value}
        {/if}{literal}, // unit of value
    clearLimits : true,
    clearValues : true,
    hehe : ":-)"
});
// -->
</script>
{/literal}</span>
</fieldset>

</dd>
<fieldset id="fieldset-ratingFieldsGroup"><legend>Рейтинг магазина</legend>
{$form->rating_from}
{$form->rating_to}
<div class="clear"></div>
<span id="rating_trackbar">{literal}        
<script type="text/javascript">
// User function
function setRatingLimits(from, to) {
    var values = ['',
     {/literal}
        {foreach from=$ratings item=rating name=rating_foreach}
            {if $smarty.foreach.rating_foreach.first}{assign var=rating_min value=$rating}{/if}
            '{$rating}',
            {if $smarty.foreach.rating_foreach.last}{assign var=rating_max value=$rating}{/if}
            {assign var=right_value value=$smarty.foreach.rating_foreach.iteration}
        {/foreach}
        {literal}
    ];
    document.getElementById("rating_from").value = values[from];
    document.getElementById("rating_to").value = values[to];
}


trackbar.getObject('rating').init({
    onMove : function() {
        setRatingLimits(this.leftValue, this.rightValue);
    },
    width : 160, // px
    leftLimit : {/literal}1{literal}, // unit of value
    leftValue : {/literal}
        {if !empty($rating_from)}
            {$rating_from}
        {else}
            1
        {/if}
    {literal}, // unit of value
    rightLimit : {/literal}{$right_value}{literal}, // unit of value
    rightValue : {/literal}
        {if !empty($rating_to)}
            {$rating_to}
        {else}
            {$right_value}
        {/if}{literal}, // unit of value
    clearLimits : true,
    clearValues : true,
    hehe : ":-)"
});
// -->
</script>
{/literal}</span>
</fieldset></dd>
{$form->manufacturers}
{$form->stock}
{$form->hit}
{$form->cid}
{foreach from=$properties_names item=property}
    {$form->$property}
{/foreach}
{$form->filter_submit}
</form>
{*  ############################ ФОРМА ЗАКОНЧИЛАСЬ########################### *}
</div>  
{/if}
